package com.fuelstations.coderone;

import java.util.ArrayList;
import java.util.List;
import java.util.Locale;

import com.example.androidhive.R;
import com.fuelstations.coderone.DatabaseMetadata.StationTableMetadata;

import android.content.Context;

public class Strings {

	public static String citiesAll;
	public static String districtAll;
	public static String unld95;
	private static List<List<String>> fuelTypes = new ArrayList<List<String>>();
	private static ArrayList<String> fuelTypesStr = new ArrayList<String>();

	public static void setContext(Context c) {

		districtAll = c.getResources().getString(R.string.district_all);
		citiesAll = c.getResources().getString(R.string.cities_all);

		fuelTypes.removeAll(fuelTypes);
		List<String> colAssosiation = new ArrayList<String>();
		colAssosiation.add(c.getResources().getString(R.string.unld95));
		colAssosiation.add(StationTableMetadata.UNLD95);
		fuelTypes.add(colAssosiation);

		colAssosiation = new ArrayList<String>();
		colAssosiation.add(c.getResources().getString(R.string.unld98));
		colAssosiation.add(StationTableMetadata.UNLD98);
		fuelTypes.add(colAssosiation);

		colAssosiation = new ArrayList<String>();
		colAssosiation.add(c.getResources().getString(R.string.unld100));
		colAssosiation.add(StationTableMetadata.UNLD100);
		fuelTypes.add(colAssosiation);

		colAssosiation = new ArrayList<String>();
		colAssosiation.add(c.getResources().getString(R.string.diesel));
		colAssosiation.add(StationTableMetadata.DIESEL);
		fuelTypes.add(colAssosiation);

		colAssosiation = new ArrayList<String>();
		colAssosiation.add(c.getResources().getString(R.string.dieselheat));
		colAssosiation.add(StationTableMetadata.DIESEL_HEATING);
		fuelTypes.add(colAssosiation);

		colAssosiation = new ArrayList<String>();
		colAssosiation.add(c.getResources().getString(R.string.kerosene));
		colAssosiation.add(StationTableMetadata.KEROSENE);
		fuelTypes.add(colAssosiation);

		fuelTypesStr.removeAll(fuelTypesStr);
		for (int i = 0; i < fuelTypes.size(); i++) {

			fuelTypesStr.add(fuelTypes.get(i).get(0));

		}

	}

	public static List<String> getFuelTypes() {

		return fuelTypesStr;

	}

	public static String getColumnNameFromFuelType(String fuelType) {

		for (int i = 0; i < fuelTypes.size(); i++) {
			if (fuelTypes.get(i).get(0).equals(fuelType))
				return fuelTypes.get(i).get(1);

		}
		
		return null;
	}
	
	public static String getFuelTypeFromColumnName(String colName) {

		for (int i = 0; i < fuelTypes.size(); i++) {
			if (fuelTypes.get(i).get(1).equals(colName))
				return fuelTypes.get(i).get(0);

		}
		
		return null;
	}

	public static String getLang() {
		return Locale.getDefault().getLanguage();
	}



}
